<?php
class PromocjeComponent extends Object {
    
    public function get_koszulki($params=null){
    	
    	$this->ProductKoszulki =& $this->getModel('ProductKoszulki');
    	if(!$this->ProductKoszulki){
    		return false;
    	}
    	
    	$joins = array();
    	$this->ProductKoszulki->recursive = 0;
    	$files = $this->ProductKoszulki->getModelColumns();
    	
    	$files = array_merge($files,array('ProductsDescriptionKoszulki.products_name','ProductsDescriptionKoszulki.products_description','SpecialKoszulki.specials_new_products_price'));
    	array_push($joins, array('table' => 'products_description', 'alias' => 'ProductsDescriptionKoszulki', 'type' => 'INNER', 'conditions' => array( 'ProductsDescriptionKoszulki.products_id = ProductKoszulki.products_id')));
    	array_push($joins, array('table' => 'specials', 'alias' => 'SpecialKoszulki', 'type' => 'INNER', 'conditions' => array( 'SpecialKoszulki.products_id = ProductKoszulki.products_id')));
    	return $this->ProductKoszulki->find('all',array('joins'=>$joins,'fields'=>$files,'conditions'=>array('ProductsDescriptionKoszulki.language_id'=>1,'SpecialKoszulki.status'=>1),'limit'=>4));

    	
    }
    

    public function get_bhp($params=null){
    	 
    	$this->ProductBhp =& $this->getModel('ProductBhp');
    	if(!$this->ProductBhp){
    		return false;
    	}
    	 
    	$joins = array();
    	$this->ProductBhp->recursive = 0;
    	$files = $this->ProductBhp->getModelColumns();
    	 
    	$files = array_merge($files,array('ProductsDescriptionBhp.products_name','ProductsDescriptionBhp.products_description','SpecialBhp.specials_new_products_price'));
    	array_push($joins, array('table' => 'products_description', 'alias' => 'ProductsDescriptionBhp', 'type' => 'INNER', 'conditions' => array( 'ProductsDescriptionBhp.products_id = ProductBhp.products_id')));
    	array_push($joins, array('table' => 'specials', 'alias' => 'SpecialBhp', 'type' => 'INNER', 'conditions' => array( 'SpecialBhp.products_id = ProductBhp.products_id')));
    	return $this->ProductBhp->find('all',array('joins'=>$joins,'fields'=>$files,'conditions'=>array('ProductsDescriptionBhp.language_id'=>1,'SpecialBhp.status'=>1),'limit'=>4));
    
    	 
    }
    
    function &getModel($name = null) {
    	$model = null;
    	if (!$name) {
    		$name = 'ProductKoszulki';
    	}
    	if($name){
    		if (PHP5) {
    			$model = ClassRegistry::init($name);
    		} else {
    			$model =& ClassRegistry::init($name);
    		}
    
    		if (empty($model)) {
    			//				$this->_error('FileUpload::getModel() - Model is not set or could not be found');
    			return null;
    		}
    	}
    	return $model;
    }
    

}